package com.corecloud.tools;

import com.corecloud.entity.SysLogEntity;
import com.corecloud.mapper.mysql.SysLogMapper;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

/**
 * 插入日志Utils
 */
@Component
public class LogEntryUtils {

	@Resource
	private SysLogMapper sysLogMapper;

	/**
	 * 插入/记录日志
	 * @param logText
	 * @param mobile
	 */
	public void sysLogS(String logText, String mobile){
		SysLogEntity sysLog = new SysLogEntity();
		sysLog.setUrl("/login/index");
		sysLog.setUserName(mobile);
		sysLog.setCreateTime(new Date());
		sysLog.setMsg(logText);
		sysLogMapper.insert(sysLog);
	}
}
